<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition 
	template="/template/templateSistema.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="tituloPagina">#{msg.uc_pre_cadastro_cliente_titulo}</ui:define>

	<ui:define name="corpo">
			
		<a><h:outputLabel value="Quantidade de registros" styleClass="corFonteVerdeEscuro"/> <span class="badge">#{preCadastroClienteMB.visao.lista.size()}</span></a>
		
		<h:panelGrid id="grid">
			<p:dataTable 
				id="dataTable" 
				var="preCadastro" 
				value="#{preCadastroClienteMB.visao.lista}"
				paginatorPosition="bottom"  
	            paginator="true" 
	            rows="10">  
	       
				<p:column headerText="#{msg.uc_pre_cadastro_cliente_nome}">  
				    <h:outputText value="#{preCadastro.nome}" />  
				</p:column>  
				
				<p:column headerText="#{msg.uc_pre_cadastro_cliente_empresa}">  
				    <h:outputText value="#{preCadastro.nomeEmpresa}" />  
				</p:column>
				
				<p:column headerText="#{msg.uc_pre_cadastro_cliente_telefone}">  
				    <h:outputText value="#{preCadastro.telefone}" />  
				</p:column>
				
				<p:column headerText="#{msg.uc_pre_cadastro_cliente_email}">  
				    <h:outputText value="#{preCadastro.email}" />  
				</p:column>
				
				<p:column headerText="#{msg.uc_pre_cadastro_cliente_mensagem}">  
				    <h:outputText value="#{preCadastro.mensage}" />  
				</p:column>
				
				<p:column headerText="#{msg.label_grid_acao}">
					<div align="center">
						<p:commandButton 
							oncomplete="confirmation.show()"
							image="ui-icon ui-icon-circle-minus" immediate="true" action="#{preCadastroClienteMB.atribuirValorEntidade(preCadastro)}">
						</p:commandButton>
					</div>  
				</p:column>
				
			</p:dataTable>
		</h:panelGrid>
		
		<p:confirmDialog 
			message="Deseja excluir o registro?"
			header="Confirmação" 
			widgetVar="confirmation">

			<div align="center">
				<p:commandButton 
					value="Sim"
					update=":painel"
					oncomplete="confirmation.hide()" 
					action="#{preCadastroClienteMB.excluirPreCadastroCliente}">
				</p:commandButton>
				<p:commandButton 
					value="Não" 
					onclick="confirmation.hide()"
					type="button" 
					immediate="true">
				</p:commandButton>
			</div>
		</p:confirmDialog>
		
	</ui:define>

</ui:composition>
